import requests from '@/utils/axios';
interface Datas {
  codesStatus?: string;
  codesName?: string;
}
interface DataItem1 {
  key: number;
  configsId: string;
  configsValue: number;
  configsName: string;
  configsMsg: string;
}
interface addDatal {
  codesMsg: string;
  codesName: string;
  configsList: DataItem1[];
}
interface editDatal {
  codesMsg: string;
  codesName: string;
  codesId: string;
  updateConfigDTO: { configsValue: number; codesId: string; configsName: string; configsMsg: string }[];
  // codesId: string;
}
//POST  /codesManager/getCodesInfo  查询所有的码表数据
export const getList = (data?: Datas) => requests({ url: '/codesManager/getCodesInfo', method: 'post', data });

//POST   /codesManager/insertCode  新增码表
export const addList = (data: addDatal) => requests({ url: '/codesManager/insertCode', method: 'post', data });

//GET  /codesManager/queryCodesInfoByNo/{codesNO}  根据码表编号查询码值信息
export const searchList = (data: { codesNo: string }) => requests({ url: '/codesManager/queryCodesInfoByNo/' + data.codesNo, method: 'get', data });

//PUT   /codesManager/updateStatusList   批量修改状态
export const modifyAllStatu = (data: { codesId: string[]; codesStatus: string }) => requests({ url: '/codesManager/updateStatusList', method: 'put', data });
// PUT / codesManager / updateStatus / { codesId }; //修改码表的状态
export const modifyStatu = (data: { codesId: string }) => requests({ url: '/codesManager/updateStatus/' + data.codesId, method: 'put' });

//PUT  /codesManager/updateInfor  修改码表的信息
export const modifyList = (data: editDatal) => requests({ url: '/codesManager/updateInfor', method: 'put', data });

//DELETE  /codesManager/deleteConfig  deleteConfig 删除一条配置记录
export const delData = (data: { configsId: string }) => requests({ url: '/codesManager/deleteConfig?configsId=' + data.configsId, method: 'delete' });

//ADD  /codesManager/addConfigs  addConfigs 添加一条配置记录
export const addData = (data: { configsValue: number; codesId: string; configsName: string; configsMsg: string }) => requests({ url: '/codesManager/addConfigs', method: 'post', data });

//DELETE  /codesManager/deleteData  deleteData 删除一条码表记录
export const delList = (data: { codesId: string }) => requests({ url: '/codesManager/deleteData?codesId=' + data.codesId, method: 'delete' });
